package com.beauty.logistics.dto;

import com.beauty.logistics.entity.Shipment;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ShipmentResponse {
    
    private Long id;
    private String trackingNumber;
    private String orderId;
    private String shippingMethod;
    private String carrierName;
    private String customerId;
    private Shipment.ShipmentStatus status;
    private LocalDateTime shippingDate;
    private LocalDateTime estimatedDeliveryDate;
    private LocalDateTime actualDeliveryDate;
    private String originAddress;
    private String destinationAddress;
    private String packageDimensions;
    private Double packageWeight;
    private String shippingLabelUrl;
    private String notes;
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;
    
    public static ShipmentResponse fromEntity(Shipment shipment) {
        return ShipmentResponse.builder()
                .id(shipment.getId())
                .trackingNumber(shipment.getTrackingNumber())
                .orderId(shipment.getOrderId())
                .shippingMethod(shipment.getShippingMethod())
                .carrierName(shipment.getCarrierName())
                .customerId(shipment.getCustomerId())
                .status(shipment.getStatus())
                .shippingDate(shipment.getShippingDate())
                .estimatedDeliveryDate(shipment.getEstimatedDeliveryDate())
                .actualDeliveryDate(shipment.getActualDeliveryDate())
                .originAddress(shipment.getOriginAddress())
                .destinationAddress(shipment.getDestinationAddress())
                .packageDimensions(shipment.getPackageDimensions())
                .packageWeight(shipment.getPackageWeight())
                .shippingLabelUrl(shipment.getShippingLabelUrl())
                .notes(shipment.getNotes())
                .createdAt(shipment.getCreatedAt())
                .updatedAt(shipment.getUpdatedAt())
                .build();
    }
} 